package com.prs.crm.dao.project.impl;

import java.util.Collection;

import org.hibernate.Criteria;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Order;
import org.springframework.orm.hibernate3.HibernateCallback;

import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.dao.project.ProjectStageDao;
import com.prs.crm.domain.project.ProjectStage;

public class ProjectStageDaoImpl extends BaseDaoImpl<ProjectStage> implements ProjectStageDao{
	
	@SuppressWarnings("unchecked")
	public Collection<ProjectStage> getAllStage()
	{
		 return (Collection<ProjectStage>)this.getHibernateTemplate().execute(
					new HibernateCallback()
					{
						public Object doInHibernate(Session session) throws HibernateException {
				        	Criteria criteria = session.createCriteria(ProjectStage.class);
				        	criteria.addOrder(Order.asc("id"));
				        	return criteria.list();
				        }   
					}
			);
	}
}
